package fr.dsax.nounet.belote.rest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import fr.dsax.nounet.belote.dto.GameDto;
import fr.dsax.nounet.belote.jpa.Game;
import fr.dsax.nounet.belote.service.GameService;

@Controller
public class GameRestService extends GenericRestService {

	@Autowired
	GameService gameService;
	
	@RequestMapping(method=RequestMethod.POST, value="/game")
	public void createGame(@PathVariable GameDto game) {
//		gameService.create(gameName);
	}
	
	@RequestMapping(method=RequestMethod.GET, value="/game/{gameId}")
	@ResponseBody
	public GameDto findGameById(@PathVariable Integer gameId) {
		Game gameEntity = gameService.findById(gameId);
		GameDto gameDto = getDozerMapper().map(gameEntity, GameDto.class);
		return gameDto;
	}
	
}
